Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Displaying Raw • Download


meshchatx/src/backend/call_timeout.py e5756d7ab065475a18acdcafc008a767fcff87e0 (e5756d7a) Text, 776 B

T8b949e# SPDX-License-Identifier: 0BSD
T8b949e"""Clamp helpers for telephone call initiation timeouts."""

Tff7b72from T7ee787__future__ Tff7b72import Te6edf3annotations

Te6edf3DEFAULT_CALL_TIMEOUT_SECONDS Tff7b72= T79c0ff15
Te6edf3MIN_CALL_TIMEOUT_SECONDS Tff7b72= T79c0ff1
Te6edf3MAX_CALL_TIMEOUT_SECONDS Tff7b72= T79c0ff120


Tff7b72def Td2a8ffclamp_call_timeout_secondsTb4b4b4(
Te6edf3rawTb4b4b4,
Tff7b72*Tb4b4b4,
Te6edf3defaultTb4b4b4: Tffa657int Tff7b72= Te6edf3DEFAULT_CALL_TIMEOUT_SECONDSTb4b4b4,
Te6edf3min_sTb4b4b4: Tffa657int Tff7b72= Te6edf3MIN_CALL_TIMEOUT_SECONDSTb4b4b4,
Te6edf3max_sTb4b4b4: Tffa657int Tff7b72= Te6edf3MAX_CALL_TIMEOUT_SECONDSTb4b4b4,
Tb4b4b4) Tff7b72-Tff7b72> Tffa657intTb4b4b4:
T8b949e"""Parse and clamp a call timeout query value.

Invalid values fall back to default. Result is always within [min_s, max_s].
"""
Tff7b72tryTb4b4b4:
Te6edf3timeout_seconds Tff7b72= Tffa657intTb4b4b4(Te6edf3rawTb4b4b4) Tff7b72if Te6edf3raw Tff7b72is Tff7b72not Tff7b72None Tff7b72else Tffa657intTb4b4b4(Te6edf3defaultTb4b4b4)
Tff7b72except Tb4b4b4(Tf85149TypeErrorTb4b4b4, Tf85149ValueErrorTb4b4b4)Tb4b4b4:
Te6edf3timeout_seconds Tff7b72= Tffa657intTb4b4b4(Te6edf3defaultTb4b4b4)
Tff7b72return Tffa657maxTb4b4b4(Tffa657intTb4b4b4(Te6edf3min_sTb4b4b4)Tb4b4b4, Tffa657minTb4b4b4(Te6edf3timeout_secondsTb4b4b4, Tffa657intTb4b4b4(Te6edf3max_sTb4b4b4)Tb4b4b4)Tb4b4b4)


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────